import request from '@/utils/request';

// 节点及连线数据
export function getNetTopology(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/netTopology/' + id,
		method: 'get',
	});
}

// 添加连线
export function addLink(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/netTopology/addLink',
		method: 'post',
		data: data,
	});
}

// 删除连线
export function deleteLink(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/netTopology/deleteLink',
		method: 'post',
		data: data,
	});
}

// 移动组件和修改组件信息
export function updateComponentInfo(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/netTopology//netTopology/setLocation',
		method: 'post',
		data: data,
	});
}

// 删除节点
export function deleteComponentInfo(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/netTopology/removeNode',
		method: 'post',
		data: data,
	});
}

// 新增节点
export function addComponentInfo(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/netTopology/addNode',
		method: 'post',
		data: data,
	});
}

// 连接方式下拉列表
export function connectType(): ApiPromise<ApiResponse> {
	return request({
		url: '/admin/system/dict/data/type/connect_type',
		method: 'get',
	});
}

// 基础设施下拉列表
export function getDeviceInfo(): ApiPromise<ApiResponse> {
	return request({
		url: '/management/device/getDeviceInfo',
		method: 'get',
	});
}

// 新增ip
export function addIpConfig(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/admin/modules/netTopology/addIpConfig',
		method: 'post',
		data: data,
	});
}

// 修改ip
export function updateIpConfig(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/admin/modules/netTopology/updateIpConfig',
		method: 'post',
		data: data,
	});
}

// 删除ip
export function deleteIpConfig(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/admin/modules/netTopology/deleteIpConfig',
		method: 'post',
		data: data,
	});
}

// 查询ip
export function getAllIp(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/admin/modules/componentIp',
		method: 'post',
		data: data,
	});
}

// 查询ip
export function system(data?: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/option/system',
		method: 'get',
		data,
	});
}
